import { uploadFiles } from '@/services/filetool';

export default {
  namespace: 'addwater',

  state: {
    // 列表数据
    data: {
      dataList: [],
      pageNum: 0,
      pageSize: 0,
      totalCount: 0,
    },

    uuid:"",

    queryForm:{},

  },

  effects: {
    * uploadFiles({payload, callback}, {call, put}) {
      const response = yield call(uploadFiles, payload);
      if (callback) callback(response);
      yield put({
        type: 'saveuuid',
        payload: response,
      });
    },

    * moveFile({payload, callback}, {call, put}) {
      const response = yield call(applyMoveFile, payload);
      if (response && response.result == 'ok') {

        yield put({
          type: 'savemoveFile',
          payload: response,
        });
        if (callback) callback(response);
      }
    },

    *getGj({ payload, callback }, { call, put }) {
      const response = yield call(queryGj, payload);
      yield put({
        type: 'savegetGj',
        payload: response,
      });
      if (callback) callback(response);
    },
  },

  reducers: {
    saveuuid(state, action) {
      return {
        ...state,
        uuid: action.payload.data,
      };
    },
  },
};
